import ScrollReveal from 'scrollreveal'

const reveal = ScrollReveal()
export const exeAnimat = (): void => {
    reveal.reveal('.left-in-1', {
        distance: '30%',
        origin: 'left',
        easing: 'ease-out',
        duration: 1000
    })
    reveal.reveal('.left-in-2', {
        distance: '40%',
        origin: 'left',
        easing: 'ease-out',
        delay: 300,
        duration: 1200,
    })
    reveal.reveal('.left-in-3', {
        distance: '50%',
        origin: 'left',
        easing: 'ease-out',
        delay: 400,
        duration: 1300,
    })
    reveal.reveal('.fade-in', {
        delay: 500,
        easing: 'ease',
        opacity: 0,
    })
    reveal.reveal('.bottom-in', {
        distance: '50px',
        delay: 700,
        origin: 'bottom',
    })
    reveal.reveal('.bottom-fade-in', {
        distance: '20%',
        origin: 'bottom',
        duration: 1000,
        easing: 'ease',
        opacity: 0,
    })
    reveal.reveal('.bottom-fade-in-1', {
        distance: '30%',
        origin: 'bottom',
        duration: 1100,
        easing: 'ease',
        delay: 100,
        opacity: 0,
    })
    reveal.reveal('.bottom-fade-in-2', {
        distance: '40%',
        origin: 'bottom',
        duration: 1200,
        easing: 'ease',
        delay: 200,
        opacity: 0,
    })
    reveal.reveal('.bottom-fade-in-3', {
        distance: '50%',
        origin: 'bottom',
        duration: 1300,
        easing: 'ease',
        delay: 300,
        opacity: 0,
    })
    reveal.reveal('.bottom-fade-in-3', {
        distance: '60%',
        origin: 'bottom',
        duration: 1400,
        easing: 'ease',
        delay: 400,
        opacity: 0,
    })
    reveal.reveal('.bottom-fade-in-4', {
        distance: '70%',
        origin: 'bottom',
        duration: 1500,
        easing: 'ease',
        delay: 500,
        opacity: 0,
    })
    reveal.reveal('.btn-scale', {
        delay: 300,
        scale: 0,
    })
    reveal.reveal('.btn-scale-1', {
        delay: 400,
        scale: 0,
    })
    reveal.reveal('.btn-scale-2', {
        delay: 500,
        scale: 0,
    })
    reveal.reveal('.btn-scale-3', {
        delay: 600,
        scale: 0,
    })
    reveal.reveal('.btn-scale-4', {
        delay: 700,
        scale: 0,
    })
    reveal.reveal('.btn-scale-5', {
        delay: 800,
        scale: 0,
    })
    reveal.reveal('.right-distance', {
        distance: '20%',
        origin: 'right',
        duration: 1500,
        easing: 'ease',
        opacity: 0,
    })
    reveal.reveal('.right-in-1', {
        distance: '20%',
        origin: 'right',
        easing: 'ease',
        duration: 900
    })
    reveal.reveal('.right-in-2', {
        distance: '30%',
        origin: 'right',
        easing: 'ease',
        delay: 300,
        duration: 1000,
    })
    reveal.reveal('.right-in-3', {
        distance: '40%',
        origin: 'right',
        easing: 'ease',
        delay: 300,
        duration: 1100,
    })
    reveal.reveal('.right-in-4', {
        distance: '50%',
        origin: 'right',
        easing: 'ease',
        delay: 300,
        duration: 1200,
    })

    reveal.reveal('.left-distance-1', {
        distance: '20%',
        origin: 'left',
        easing: 'ease',
        duration: 900
    })
    reveal.reveal('.left-distance-2', {
        distance: '30%',
        delay: 100,
        origin: 'left',
        easing: 'ease',
        duration: 1000
    })
    reveal.reveal('.left-distance-3', {
        distance: '40%',
        delay: 200,
        origin: 'left',
        easing: 'ease',
        duration: 1100
    })
    reveal.reveal('.left-distance-4', {
        distance: '50%',
        delay: 300,
        origin: 'left',
        easing: 'ease',
        duration: 1200
    })
    reveal.reveal('.left-distance-5', {
        distance: '60%',
        delay: 400,
        origin: 'left',
        easing: 'ease',
        duration: 1300
    })
}

export const download = (url: string) => {
    const a: HTMLAnchorElement = document.createElement('a')
    a.style.display = 'none'
    a.href = url
    document.body.appendChild(a)
    a.click()
    document.body.removeChild(a)
}
